//
//  UIButton+Style.m
//  TryToWtrie
//
//  Created by 钱金军 on 2018/10/26.
//  Copyright © 2018年 钱金军. All rights reserved.
//

#import "UIButton+Style.h"

@implementation UIButton (Style)

- (UIButton *)setText:(NSString *)text withTextColor:(UIColor *)color withFont:(UIFont *)font withRoundedCorners:(double)corners andBackgroundColor:(UIColor *)backgroundColor{
    
    [self setTitle:text forState:UIControlStateNormal];
    [self setTitleColor:color forState:UIControlStateNormal];
    self.titleLabel.font = font;
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.layer.cornerRadius = corners;
    self.backgroundColor = backgroundColor;
    
    return self;
}

- (UIButton *)setText:(NSString *)text withTextColor:(UIColor *)color withFont:(UIFont *)font withRoundedCorners:(double)corners andBackgroundColor:(UIColor *)backgroundColor withBorderColor:(UIColor *)borderColor{
    
    [self setTitle:text forState:UIControlStateNormal];
    [self setTitleColor:color forState:UIControlStateNormal];
    self.titleLabel.font = font;
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.layer.cornerRadius = corners;
    self.backgroundColor = backgroundColor;
    self.layer.borderWidth = 0.5;
    self.layer.borderColor = borderColor.CGColor;
    
    return self;
}


@end
